import React, { Component } from 'react';
import {
  AsyncStorage
} from 'react-native';

import {
  StackNavigator,
} from 'react-navigation';
import LoginScreen from './app/LoginScreen';
import HomeScreen from './app/HomeScreen';
import AnswearScreen from './app/AnswearScreen'
import Storage from 'react-native-storage';
import Orientation from 'react-native-orientation';
import SpaceScreen from './app/SpaceScreen'

var storage = new Storage({
  // 最大容量，默认值1000条数据循环存储
  size: 1000,
  // 存储引擎：对于RN使用AsyncStorage，对于web使用window.localStorage
  // 如果不指定则数据只会保存在内存中，重启后即丢失
  storageBackend: AsyncStorage,
  // 数据过期时间，默认一整天（1000 * 3600 * 24 毫秒），设为null则永不过期
  defaultExpires: null,
  // 读写时在内存中缓存数据。默认启用。
  enableCache: true,
  // sync: require('./sync')
})
global.storage = storage;
const App = StackNavigator({
  LoginScreen: {screen: LoginScreen},
  AnswearScreen:{screen: AnswearScreen},
  HomeScreen: {screen: HomeScreen},
  SpaceScreen:{screen:SpaceScreen}
});

export default class Edu extends Component{
  componentDidMount(){
    Orientation.lockToLandscape();
    Orientation.lockToLandscape();
    Orientation.lockToLandscape();
  }
  render(){
    return (
      <App/>
    )
  }
}